<template>
      <el-divider style="margin-top: 51px; margin-bottom: 51px" content-position="center">
      <p style="
          font-size: 20px;
          font-weight: normal;
          font-family: 'Courier New', Courier, monospace;
        ">
        鲜花小店
      </p>
    </el-divider>
    <div class="main">
        <div class="ItemBody">
        <div class="ItemContainer">
            <el-row>
            <el-col :span="12">
                <div class="ItemCard">
                <img :src="this.ItemList[0].image" />
                <div class="text">
                    <h2>{{ this.ItemList[0].name }}</h2>
                    <p>价格：{{ this.ItemList[0].price }}</p>
                    <p>描述：{{ this.ItemList[0].detail }}</p>
                </div>
                </div>
            </el-col>
            <el-col :span="12">
                <div class="ItemCard">
                <img :src="this.ItemList[1].image" />
                <div class="text">
                    <h2>{{ this.ItemList[1].name }}</h2>
                    <p>价格：{{ this.ItemList[1].price }}</p>
                    <p>描述：{{ this.ItemList[1].detail }}</p>
                </div>
                </div>
            </el-col>
            </el-row>
            <el-row>
            <el-col :span="12">
                <div class="ItemCard">
                <img :src="this.ItemList[3].image" />
                <div class="text">
                    <h2>{{ this.ItemList[3].name }}</h2>
                    <p>价格：{{ this.ItemList[3].price }}</p>
                    <p>描述：{{ this.ItemList[3].detail }}</p>
                </div>
                </div>
            </el-col>
            <el-col :span="12">
                <div class="ItemCard">
                <img :src="this.ItemList[4].image" />
                <div class="text">
                    <h2>{{ this.ItemList[4].name }}</h2>
                    <p>价格：{{ this.ItemList[4].price }}</p>
                    <p>描述：{{ this.ItemList[4].detail }}</p>
                </div>
                </div>
            </el-col>
            </el-row>
        </div>
        </div>
        <div class="ItemRight">
            <div class="ItemImg">
              <img style="width: 100%;height: 100%;border-radius: 118px" src="@/assets/QQ图片20230607002147.png"/>
            </div>
            <div>
              <div class="IntroduceTitle">常见鲜花品种：</div>
               <div class="Introduce">{{ Introduce }}</div>
            </div>
           
            <div class="ItemImage">
                <img style="width: 100%;" src="@/assets/QQ图片20230606212941.png" />
            </div>
            <div class="ImageTitle">{{ ImageTitle }}</div>
            <div class="ImageText">{{ ImageText }}</div>
        </div>
    </div>
</template>

<script>
import { getRandomItemList } from '@/api/item';
export default {
    data(){
        return{
          ImageTitle:"鲜花小店",
          ImageText:"专门为用户提供优质商品购买的在线平台。我们致力于为用户呈现丰富多彩的鲜花及相关产品，包括花束、花束套装、花篮、花盒、永生花等。我们的鲜花小店以精心挑选的花卉为特色，每一束鲜花都经过精心包装和布置，确保每一朵花都散发出迷人的芳香和美丽的姿态。我们的花材来自于优质的供应商，经过专业团队的处理和保养，以确保鲜花的新鲜度和品质。",
          Introduce:"玫瑰、康乃馨、郁金香、百合、雏菊、牡丹、铃兰、桔梗、青莲、蝴蝶兰、万寿菊、银杏、向日葵、紫罗兰、勿忘我...",  
          ItemList: [
        {
          name: "商品",
          image: '',
          price: "1020",
          detail: "详细信息",
          url: "#",
        },
        {
          name: "商品",
          image: '',
          price: "1020",
          detail: "详细信息",
          url: "#",
        }, {
          name: "商品",
          image: '',
          price: "1020",
          detail: "详细信息",
          url: "#",
        }, {
          name: "商品",
          image: '',
          price: '',
          detail: "详细信息",
          url: "#",
        }, {
          name: "商品",
          image: "",
          price: "1020",
          detail: "详细信息",
          url: "#",
        }, {
          name: "商品",
          image: "",
          price: "1020",
          detail: "详细信息",
          url: "#",
        },
      ],
        }
    },
    methods:{
        getRandomItem(){
      var params = {
        count: Number(4)
      }
      return getRandomItemList(params)
      .then((response)=>{
        var getData = response.data.data
        for (var item in getData){
          this.ItemList[item].name=getData[item].name
          this.ItemList[item].price=getData[item].price
          this.ItemList[item].image=getData[item].picture
          this.ItemList[item].detail=getData[item].description
          //this.ItemList[item].url=getData[item].name
        }
      })
      .catch((error)=>{
        console.log(error.response.data.data)
      })
    }
    },
    mounted: function () {
    this.getRandomItem()
  }
}
</script>

<style scoped>
.main{
    display: flex;
    justify-content: space-around;
}
.ItemBody{
    width: 666px;
}
.ItemContainer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
}

.ItemCard {
    width: 205px;
    height: 236px;
  overflow: hidden;
  margin: 10px;
  background-color: #000;
  color: #fff;
  cursor: pointer;
  position: relative;
}

.ItemCard img {
  width: 100%;
  height: 100%;
  transition: 0.35s;
}

.ItemCard .text {
  position: absolute;
  inset: 30px;
  padding: 0 18px;
}

.ItemCard .text::before {
  content: "";
  position: absolute;
  inset: 0;
  left: 100%;
  border-left: 4px solid rgba(225, 225, 225, 0.8);
  background-color: rgba(225, 225, 225, 0.5);
  opacity: 0;
  transition: 0.5s;
  transition-delay: 0.6s;
}

.ItemCard .text h2,
.ItemCard .text p {
  margin-bottom: 6px;
  opacity: 0;
  transition: 0.35s;
}

.ItemCard .text h2 {
  font-weight: 300;
  text-transform: uppercase;
  transform: translate(30%, 0%);
  transition-delay: 0.3s;
}

.ItemCard .text p {
  font-weight: 200;
  transform: translate(0%, 30%);
}

.ItemCard:hover img {
  opacity: 0.3;
}

.ItemCard:hover .text h2 {
  opacity: 1;
  transform: translate(0%, 0%);
  transition-delay: 0.4s;
}

.ItemCard:hover .text p {
  opacity: 0.9;
  transform: translate(0%, 0%);
  transition-delay: 0.6s;
}

.ItemCard:hover .text::before {
  background-color: rgba(225, 225, 225, 0);
  left: 0;
  opacity: 1;
  transition-delay: 0s;
}
.ItemRight{
    width: 800px;
    height: 500px;
    background: linear-gradient(316deg, #f2f0d7, #fef0f000);
}
.ItemImage{
width: 246px;
    position: relative;
    margin-left: 420px;
}
.ImageTitle{
width: 43px;
    height: 184px;
    position: relative;
    margin-top: -343px;
    margin-left: 332px;
    font-size: 35px;
    color: #ffa336c2;
    font-family: cursive;
    font-weight: 600;
}
.ImageText{
  width: 280px;
    height: 188px;
    position: relative;
    margin-top: -87px;
    margin-left: 44px;
    font-size: 15px;
    color: #000000c9;
    font-family: cursive;

}
.ItemImg{
  width: 235px;
    height: 235px;
    position: relative;
    margin: 23px;
    opacity: 0.8;
}
.Introduce{
  width: 247px;
    height: 100px;
    position: absolute;
    margin-top: -167px;
    margin-left: 400px;
    font-size: 15px;
    font-family: cursive;
}
.IntroduceTitle{
  width: 247px;
    height: 100px;
    position: absolute;
    margin-top: -200px;
    margin-left: 400px;
    font-family: cursive;
    font-weight: bolder;
    font-size: 19px;
    color: #fac98e;
}
</style>